﻿namespace WellFormattedZhouyiGenerator.Writers;
internal sealed class CombinedWriters : IDocumentWriter
{
    public required IEnumerable<IDocumentWriter> Writers { get; init; }

    public void PreWrite()
    {
        foreach (var writer in this.Writers)
            writer.PreWrite();
    }

    public void WriteLine(string? s)
    {
        foreach (var writer in this.Writers)
            writer.WriteLine(s);
    }

    public void WriteTitle(string? s, int level = 1)
    {
        foreach (var writer in this.Writers)
            writer.WriteTitle(s, level);
    }

    public void PostWrite()
    {
        foreach (var writer in this.Writers)
            writer.PostWrite();
    }

    public void Dispose()
    {
        foreach (var writer in this.Writers)
            writer.Dispose();
    }
}
